#pragma once


#include <iostream>
#include <sys/types.h>
#include <sys/stat.h>
#include <cstdlib>
#include <cstdio>
#include <unistd.h>
#include <fcntl.h>
#include <string>
#include <cstring>
#include "log.hpp"

#define Filename "myfifo"
#define MKFIFO_ERR  1
#define OPEN_ERR    2
#define CLOSE_ERR   3
#define DELETE_ERR  4
#define SIZE 1024



class Inif
{
public:
    Inif()
    {
        int ret = mkfifo(Filename, 0664);
        if (ret == -1)
        {
            perror("mkfifo");
            exit(MKFIFO_ERR);
        }
    }
    ~Inif()
    {
        int ret = unlink(Filename);
        if (ret == -1)
        {
            perror("unlink");
            exit(DELETE_ERR);
        }
    }
};